BlogHow to

Firefox Is Now ”More Than 75X Faster” Running WebAssembly


Mozilla is rolling out more performance improvements to Firefox, this time focused on the browser’s WebAssembly runtime. Some processing tasks are now more than 75 times faster in Firefox.


Some more advanced web applications and games use code that compiles to WebAssembly, instead of code written in or compiled to JavaScript. WebAssembly is mainly used for complex video, audio, and 3D rendering tools, such as the web versions of Adobe Photoshop, SketchUp, Google Earth, Figma, and games built with Unity. However, Firefox has some performance issues with compiling WebAssembly code, which can slow down responsiveness and initial loading times for web apps using it.


A post on Mozilla’s SpiderMonkey development blog explains, “When Baseline compilation is finished, we compile the Wasm module with our more advanced Ion compiler. This backend produces faster machine code, but compilation time is a lot higher. The issue with the ONNX module was that the Ion compiler backend took a long time and used a lot of memory to compile it. On my Linux x64 machine, Ion-compiling this module took about 5 minutes and used more than 4 GB of memory. Even though this work happens on background threads, this was still too much overhead.”


Mozilla engineers were able to update the register allocator for Firefox’s Ion component with a more efficient vector method, which made compile times around 20 times faster, and updated other components of the compiler with different algorithms. The blog post says, “With these changes, Ion can compile the ONNX Wasm module in less than 3.9 seconds on my machine, more than 75x faster than before these changes.”

The end result is that Photoshop, Google Earth, and other web apps and games using WebAssembly should generally load faster in Firefox. The entire web app won’t get that “up to 75x” speed boost, but certain operations in the app will be faster. Mozilla says one of the large WebAssembly modules used by the free online Photoshop demo now compiles in 14 seconds in Firefox, instead of four minutes, and one test in the JetStream 2 web benchmark now finishes in 0.2 seconds instead of 2.8 seconds.


Mozilla is working on other improvements to WebAssembly in Firefox, so complex web apps should continue to improve over time. That’s certainly great to see, on top of other usability improvements like local translation.

Source: SpiderMonkey Blog


Source link

Related Articles

Back to top button
close